package cn.jxwazx.sheinspringboot.controller;

import cn.jxwazx.sheinspringboot.entity.R;
import cn.jxwazx.sheinspringboot.entity.param.Top10Param;
import cn.jxwazx.sheinspringboot.entity.vo.Top10ProductVo;
import cn.jxwazx.sheinspringboot.entity.vo.Top10Vo;
import cn.jxwazx.sheinspringboot.service.ProductListService;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.RequiredArgsConstructor;
import org.springframework.context.annotation.Lazy;
import org.springframework.web.bind.annotation.*;

/**
 * @author LoveHuaHua
 * @date 2024年04月03日 14:02
 * @description believe in yourself
 */
@RestController
@RequestMapping("/statistics")
@RequiredArgsConstructor(onConstructor = @__(@Lazy))
public class StatisticsController {
    private final ProductListService productListService;


    /**
     * top10的店铺销量
     * @param param
     * @return
     */
    @PostMapping("/top10")
    public Object top10(@RequestBody Top10Param param){
        Page<Top10Vo> page = productListService.top10(param);
        return R.successPage(page);

    }

    @PostMapping("/top10Product")
    public Object top10Product(@RequestBody Top10Param param){
        Page<Top10ProductVo> page = productListService.top10Product(param);
        return R.successPage(page);
    }
}
